/*
 * RelativeLocation.java
 *
 * Created on 18 maart 2008, 15:13
 *
 * @author wijnand.schepens@hogent.be
 */

package model.graphic.locations;

import java.io.Serializable;

public abstract class RelativeLocation implements Location, Serializable
{
	private Location base;
	protected int relativeX;
	protected int relativeY;
    
    public RelativeLocation(){}
	
	public RelativeLocation(Location base, int relativeX, int relativeY)
	{
		this.base = base;
		this.relativeX = relativeX;
		this.relativeY = relativeY;
	}
	
	public Location getBase()
	{
		return base;
	}

	public int getX()
	{
		return base.getX() + relativeX;
	}

	public int getY()
	{
		return base.getY() + relativeY;
	}

	public int getRelativeX()
	{
		return relativeX;
	}

	public int getRelativeY()
	{
		return relativeY;
	}

	public void setRelativeXY(int relativeX, int relativeY)
	{
		this.relativeX = relativeX;
		this.relativeY = relativeY;
	}

    public void print(){
        System.out.println("rel x: "+(base.getX()+relativeX)+" - y: "+(base.getY()+relativeY));
    }

    /**
     * @param base the base to set
     */
    public void setBase(Location base) {
        this.base = base;
    }
	
}
